package com.gagakuai.engine.impl.delegate;

/*
 * @program: common-starters
 * @description: java类型的委托执行器:类似与处理 在用户任务设置java class的类型处理
 * @author: houhong
 * @create: 2023-01-02 00:28
 */
public class JavaDelegateInvocation extends DelegateInvocation {

    private final JavaDelegate delegateInstance;
    private final DelegateExecution delegateExecution;

    /*
    *  构造器注入
    */
    public JavaDelegateInvocation(JavaDelegate javaDelegate, DelegateExecution delegateExecution) {
        this.delegateInstance = javaDelegate;
        this.delegateExecution = delegateExecution;
    }

    @Override
    public void invoke() throws Exception {
        delegateInstance.execute(delegateExecution);
    }

    @Override
    public Object getTarget() {
        return delegateInstance;
    }
}